package com.qsl.datax.plugin.writer.kafkawriter;

import cn.hutool.json.JSONUtil;
import com.alibaba.datax.common.element.Column;

/**
 * @description: xxx描述
 * @author: youzhibing
 * @date: 2024/8/20 16:25
 */
public class KafkaColumn {

    private Column.Type columnType;
    private String columnName;
    private Object columnValue;
    private int byteSize;

    public KafkaColumn() {}

    public KafkaColumn(Column column, String columnName) {
        this.columnType = column.getType();
        this.columnValue = column.getRawData();
        this.byteSize = column.getByteSize();
        this.columnName = columnName;
    }

    public Column.Type getType() {
        return columnType;
    }

    public void setType(Column.Type columnType) {
        this.columnType = columnType;
    }

    public Object getColumnValue() {
        return columnValue;
    }

    public void setColumnValue(Object columnValue) {
        this.columnValue = columnValue;
    }

    public int getByteSize() {
        return byteSize;
    }

    public void setByteSize(int byteSize) {
        this.byteSize = byteSize;
    }

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    @Override
    public String toString() {
        return JSONUtil.toJsonStr(this);
    }
}
